import React, { useEffect, useState } from 'react'
import DetailsView from '../DetailsView'
import api from '../../../api'
import './style.less'

const Details = (props) => {

  const [detailsData,setDetailData] = useState({})

  useEffect(() => {
    api.details({
      id:props.id
    }).then(res => {
      if(res.status == 200) {
        // console.log(res.data);
        setDetailData(res.data)
      }
    })
  },[])

  return (
    <div>
      {
        detailsData.imgs ? <DetailsView detailsData={ detailsData } id={ props.id }/> : <div className='load'>等待数据加载</div>
      } 
    </div>
  )
}

export default Details